package com.example.littleken.listadapter;

import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.widget.ListView;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

public class SecondActivity extends AppCompatActivity {
    protected ListView lv2;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_second);
        lv2 = (ListView) findViewById(R.id.lv2);

        List<Map<String,Object>> list = new ArrayList<Map<String,Object>>();
        Map<String,Object> map = new HashMap<String,Object>();
        map.put("logo",R.drawable.find_main_hotwind);
        map.put("title","千千静听");
        map.put("version","版本：1.0");
        map.put("size","19M");
        list.add(map);

        map = new HashMap<String,Object>();
        map.put("logo",R.drawable.find_main_square);
        map.put("title","时空猎人");
        map.put("version","版本：2.0");
        map.put("size","23M");
        list.add(map);

        map = new HashMap<String,Object>();
        map.put("logo",R.drawable.find_main_travel);
        map.put("title","coc");
        map.put("version","版本：2.1");
        map.put("size","500M");
        list.add(map);

        map = new HashMap<String,Object>();
        map.put("logo",R.drawable.find_main_hotwind);
        map.put("title","千千静听");
        map.put("version","版本：1.0");
        map.put("size","19M");
        list.add(map);

        map = new HashMap<String,Object>();
        map.put("logo",R.drawable.find_main_square);
        map.put("title","时空猎人");
        map.put("version","版本：2.0");
        map.put("size","23M");
        list.add(map);

        map = new HashMap<String,Object>();
        map.put("logo",R.drawable.find_main_travel);
        map.put("title","coc");
        map.put("version","版本：2.1");
        map.put("size","500M");
        list.add(map);

        MyAdapter myAdapter = new MyAdapter(this);
        myAdapter.setList(list);//传数据源
        lv2.setAdapter(myAdapter);
    }
}
